﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace WebClient {
    public partial class WebForm1 : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {

        }

        protected void CreateChangeRequest_Click(object sender, EventArgs e) {
            dom.proxy.service service = new WebClient.dom.proxy.service();
            dom.proxy.APIAccessToken at = new WebClient.dom.proxy.APIAccessToken();
            at.hostname = Request.ServerVariables["REMOTE_HOST"];
            HttpCookie ssid = Request.Cookies.Get("SSID");
            at.sessionID = ssid.Value;
            HttpCookie uname = Request.Cookies.Get("Uname");
            at.username = uname.Value;

            dom.proxy.listOfCRs result = new WebClient.dom.proxy.listOfCRs();

            result = service.CreateChangeRequest(at, CreateCRTextBox.Text);
            dom.proxy.CRArray res = new WebClient.dom.proxy.CRArray();
            res = result.data;
            dom.proxy.ChangeRequest cr = (dom.proxy.ChangeRequest) res.list.GetValue(0);

            cr_result.Text = result.ResponseMessage + " PROPOSAL: " +  cr.request;

        }
    }
}
